package com.kong;


import com.kong.config.DatasourceConfig;
import com.kong.dao.UserService;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author gedachao
 * @description
 * @date 2020-08-24 9:00
 */
public class AppConfig {

	public static void main(String[] args) {
		ClassPathXmlApplicationContext applicationContext
				= new ClassPathXmlApplicationContext("application.xml");
		UserService bean = applicationContext.getBean(UserService.class);
		System.out.println(bean);
		boolean contains = applicationContext.containsBean("dog");
		System.out.println("xml contains dog bean: " + contains);


		AnnotationConfigApplicationContext annotationContext
				= new AnnotationConfigApplicationContext(DatasourceConfig.class);
		boolean contains2 = annotationContext.containsBean("dog");
		System.out.println("xml contains dog bean: " + contains2);
	}

}
